package br.com.guiaaluno.resposta;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import br.com.guiaaluno.aluno.Aluno;
@Entity
@Table(name = "tb_resposta")
public class Resposta implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7421048749723090002L;
	@Id
	@GeneratedValue
	@Column(name = "id")
	private Integer id;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	private Integer curtiu;
	private Integer descurtiu;
	
	@ManyToOne
	@OnDelete(action = OnDeleteAction.CASCADE)
	@JoinColumn(name = "cod_aluno", nullable = false)
	private Aluno aluno;
  	
	private String resposta;



	public Integer getCurtiu() {
		return curtiu;
	}

	public void setCurtiu(Integer curtiu) {
		this.curtiu = curtiu;
	}

	public Integer getDescurtiu() {
		return descurtiu;
	}

	public void setDescurtiu(Integer descurtiu) {
		this.descurtiu = descurtiu;
	}

	public Aluno getAluno() {
		return aluno;
	}

	public void setAluno(Aluno aluno) {
		this.aluno = aluno;
	}

	public String getResposta() {
		return resposta;
	}

	public void setResposta(String resposta) {
		this.resposta = resposta;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((aluno == null) ? 0 : aluno.hashCode());
		result = prime * result + ((curtiu == null) ? 0 : curtiu.hashCode());
		result = prime * result
				+ ((descurtiu == null) ? 0 : descurtiu.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((resposta == null) ? 0 : resposta.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Resposta other = (Resposta) obj;
		if (aluno == null) {
			if (other.aluno != null)
				return false;
		} else if (!aluno.equals(other.aluno))
			return false;
		if (curtiu == null) {
			if (other.curtiu != null)
				return false;
		} else if (!curtiu.equals(other.curtiu))
			return false;
		if (descurtiu == null) {
			if (other.descurtiu != null)
				return false;
		} else if (!descurtiu.equals(other.descurtiu))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (resposta == null) {
			if (other.resposta != null)
				return false;
		} else if (!resposta.equals(other.resposta))
			return false;
		return true;
	}

	
}
